package resources.web;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Unit test for the <code>RoleController</code> controller.
 *
 * @see resources.web.RoleController
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"file:./resources/Scaffold-security-context.xml",
		"file:./resources/Scaffold-service-context.xml",
		"file:./resources/Scaffold-dao-context.xml",
		"file:./resources/Scaffold-web-context.xml" })
public class RoleControllerTest {
	/**
	 * The Spring application context.
	 *
	 */
	private ApplicationContext context;

	/**
	 * Test <code>editRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>listRoleUsers()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetlistRoleUsers() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/listRoleUsers");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>indexRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetindexRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/indexRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>editRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteRole()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteRole() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteRole");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>roleControllerbinaryaction()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetroleControllerbinaryaction() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/roleController/binary.action");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		RoleController controller = (RoleController) context.getBean("RoleController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Returns a mock HttpServletRequest object.
	 *
	 */
	private MockHttpServletRequest getMockHttpServletRequest() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
		return request;
	}

	/**
	 * Returns a mock HttpServletResponse object.
	 *
	 */
	private MockHttpServletResponse getMockHttpServletResponse() {
		return new MockHttpServletResponse();
	}
}